import { defineStore } from "pinia";
import { ref } from "vue";

export const useoldTicketStore = defineStore( // 使用导出变量名
  "oldTicket",
  () => {
    const ticket = ref({}); // 状态相关内容

    const setTicket = (newTicket) => {
      ticket.value = newTicket; // 更新票据
    };

    const removeTicket = () => {
      ticket.value = {}; // 移除当前票据
    };

    return { ticket, setTicket, removeTicket };
  },
  { persist: true }
);
